/* ===============================
   0. Base Setup
   =============================== */

html {
    font-size: 14px; /* Increased base for accessibility */
    box-sizing: border-box;
    scroll-behavior: smooth;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem; /* 14px */
    line-height: 1.5;
    color: #111;
    background-color: #fff;
    margin: 0;
    padding: 0 1rem;
}

/* ===============================
   1. Global Typography and Structure
   =============================== */

/* Consistent heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: Arial, Helvetica, sans-serif;
    color: #111;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* Sizes are scaled for clarity and readability */
h1 {
    font-size: 1.45rem;   /* ˜ 23px */
    font-weight: bold;
    padding-bottom: 0.25rem;
}

h2 {
    font-size: 1.3rem; /* ˜ 20px */
    font-weight: bold;
}

h3 {
    font-size: 1.15rem; /* ˜ 18px */
    font-weight: bold;
}

/* Paragraphs and spacing */
p {
    font-size: 1rem;
    margin: 1rem 0;
}

/* Links */
a {
    color: #0033aa;
    text-decoration: underline;
}
a:hover, a:focus {
    color: #45baea;
    text-decoration: none;
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    padding-left: 1rem;
}

/* ===============================
   2. Podcast Episode Structure
   =============================== */

.podcast-episode {
    margin: 5px 0;
    padding: 5px;
    background-color: white;
}

/* Image + Text container */
.episode-media-container {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 2px;
}

/* Right side column containing title and controls */
.episode-text-container {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ===============================
   3. Image Styling
   =============================== */

.episode-image {
    max-width: 600px;
    width: 100%;
    height: auto;
    min-width: 100px;
    object-fit: contain;
    border-radius: 0px;
}

/* ===============================
   4. Episode Titles and Summary
   =============================== */

.episode-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: #000;
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.episode-summary {
    font-size: 1.0rem;
    line-height: 1.2;
    color: #111;
    margin-top: 10px;
}

/* ===============================
   5. Controls and Buttons
   =============================== */

.podcast-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}

.action-button {
    padding: 3px 20px;
    border-radius: 28px;
    text-decoration: none;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.3s, opacity 0.3s, border-color 0.3s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    cursor: pointer;
}

.primary-button {
    background-color: #444;
    color: #fafafa;
}

.secondary-button {
    background-color: #444;
    color: #fafafa;
}

.action-button:hover, .action-button:focus {
    opacity: 0.9;
    outline: 4px solid black;
    outline-offset: 3px;
}

/* ===============================
   6. Audio Player
   =============================== */

.audio-player {
    color-scheme: dark;
    background-color: #ddd;
    border-radius: 36px;
    padding: 3px;
    height: 36px;
    flex: 1;
    min-width: 250px;
}

/* ===============================
   7. Miscellaneous Elements
   =============================== */

.container {
    max-width: none;
    margin: 0 auto;
}

img {
    max-width: 100%;
    height: auto;
}

/* Increase spacing for general accessibility */
header, main, footer {
    margin-bottom: 1.5rem;
}

hr {
    border: none;             /* removes default 3D shading or inset line */
    height: 2px;              /* sets thickness */
    background-color: #444;   /* defines the color */
    width: 100%;              /* controls the length of the line */
}

/* ===============================
   8. Media Queries (Tablet/Desktop)
   =============================== */

@media (min-width: 600px) {
    .episode-image {
        width: 150px;
        min-width: 150px;
    }

    .podcast-controls {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .audio-player {
        max-width: 450px;
        flex-grow: 0;
    }
}

/* ===============================
   8A. Media Queries (Small Screens)
   =============================== */

@media (max-width: 599px) {
    /* Stack episode layout vertically */
    .episode-media-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Make the podcast controls vertical */
    .podcast-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    /* Ensure buttons match width and are easy to tap */
    .action-button {
        width: 100%;
        font-size: 1.05rem; /* slightly larger for accessibility */
        padding: 12px 0;
    }

    /* Make the audio player full width as well */
    .audio-player {
        width: 100%;
        max-width: none;
        min-width: auto;
        height: 48px; /* slightly taller for easier touch interaction */
    }

    /* Optionally center image and reduce its size */
    .episode-image {
        width: 80%;
        max-width: 300px;
    }
}

/* ===============================
   8B. Search Field Styling
   =============================== */

/* Center the search form */
form[action*="search"], form[name="search"], form {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    text-align: center;
}

/* Style the text input field */
input[type="text"],
input[name="string"] {
    border: 3px solid #333;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1rem;
    background-color: #fafafa;
    color: #000;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

/* Highlight when focused */
input[type="text"]:focus {
    outline: none;
    border: 6px solid #0066cc;  
}

/* Style the submit button */
input[type="submit"] {
    background-color: #444;
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 8px 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s, opacity 0.3s;
}

input[type="submit"]:hover,
input[type="submit"]:focus {
    background-color: #222;
    opacity: 0.9;
}
